package com.edu.service.impl;

import com.edu.bean.Admin;
import com.edu.dao.AdminDao;
import com.edu.dao.impl.AdminDaoImpl;
import com.edu.service.AdminService;

import java.util.HashMap;
import java.util.Map;

/**
 * @Auther:zzp
 * @Date:2025/9/19-14:39:38
 */
public class AdminServiceImpl implements AdminService {

    AdminDao adminDao = new AdminDaoImpl();

    @Override
    public Map<String, Object> login(String adminName, String password) {
        Map<String,Object> result = new HashMap();
        Admin admin = adminDao.selectAdmin(adminName, password);
        if(admin != null) {
            result.put("loginAdmin", admin);
        }else {
            admin = adminDao.selectAdminByAdminName(adminName);
            if(admin != null) {
                result.put("msg", "密码错误");
            }else {
                result.put("msg", "账号不存在");
            }
        }
        return result;
    }
}
